package org.richin.collection.util;

import static org.junit.Assert.*;

import java.util.Map;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.richin.reflection.util.TypeUtil;

public class QuickMapTest {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testQuickMapObjectArray() {
		QuickMap map=new QuickMap();
		map.put("firstName", "li", "lastName", "chunlei");
		String firstName = (String)map.get("firstName");
		assertTrue(firstName.equals("li"));
		String lastName = (String)map.get("lastName");
		assertTrue(lastName.equals("chunlei"));	
		System.out.println(TypeUtil.typeToString("map",map));

		}
	

	@Test
	public void testPutObjectArray() {
		QuickMap map = new QuickMap("firstName", "li", "lastName", "chunlei", "age");
		String firstName = (String)map.get("firstName");
		assertTrue(firstName.equals("li"));
		String lastName = (String)map.get("lastName");
		assertTrue(lastName.equals("chunlei"));
		
		assertNull(map.get("age"));
	}

	@Test
	public void testAdd() {
		QuickMap map = new QuickMap();
		map.add("firstName", "li").add("lastName", "chunlei").add("age", 88);
		String firstName = (String)map.get("firstName");
		assertTrue(firstName.equals("li"));
		String lastName = (String)map.get("lastName");
		assertTrue(lastName.equals("chunlei"));
		int age = (Integer)map.get("age");
		assertTrue(age == 88);
	}

}
